package NoMatchedMessage;

use Exporter 'import';
@EXPORT = qw(noMatchedMessage);

use Signature;

sub noMatchedMessage {
	my ($class, $module) = @_;
	
	my $message = "Not found matched constuctor for class: '".signature($class)."', in module: '".signature($module->class())."'\n";
	
	my @ctors = $class->constructors();
	
	if (@ctors == 0) {
		$message .= "No constuctors found\n";		
	} else {
		$message .= "Known ctors:\n";
		
		foreach (@ctors) {
			$message .= "\t" . signature($class) . "(" . signature(ctor_sig($_)) . ")\n";
			foreach (@{$_->args()}) {
				my $provider = $module->class_provider($_->to_class());
				
				$message .= "\t\t". signature($_);
				
				if ($provider) {
					$message .= " - provided through " . $provider . "()\n";
				} else {
					$message .= " - not provided by module\n";
				}
			}
		}	
	}
	
	return $message;
}

1;